package com.ljl.ningwei.common.config;

import com.ljl.ningwei.common.handler.JWTIntercepter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMVCConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        JWTIntercepter jwtIntercepter = new JWTIntercepter();
        registry.addInterceptor(jwtIntercepter)
                .addPathPatterns("/**")
                //注意：登陆和注册请求放行
                .excludePathPatterns("/console/login");
    }
}
